function getCitiesOptions(countyInput, cityInput) {
	var countyID = parseInt($('#' + countyInput).val());
	if (countyID > 0) {
		var responseLoc = $.ajax({
			type: "POST",
			url: "/ajax/index/get-cities",
			data: "county_id="+countyID,
			async: false
		}).responseText;


		try {
			var arrResponseLoc = eval('('+responseLoc+')');
		} catch(err) {
			jAlert('Momentan este o problema cu serverul reveniti', 'Atentie');
			return false;
		}

		if (arrResponseLoc.result) {
			var output = '';
			for(var i in arrResponseLoc.arrCities) {
				if (parseInt(i) == parseInt($('#' + cityInput + '_selected').val()))
					output+='<option selected value="'+i+'">'+arrResponseLoc.arrCities[i]+'</option>';
				else
					output+='<option value="'+i+'">'+arrResponseLoc.arrCities[i]+'</option>';
			}
			if (output != '')
				$('#' + cityInput).html(output);
			else {
				output = '<option value=""> - Alege judet - </option>';
				$('#' + cityInput).html(output);
			}

		} else {
			if (arrResponseLoc.message)
				jAlert(arrResponseLoc.message, 'Atentie');
			else
				jAlert('Momentan este o problema cu serverul reveniti', 'Atentie');
			return false;
		}
	} else {
		output = '<option value=""> - Alege judet - </option>';
		$('#' + cityInput).html(output);
	}
	return false;
}

function checkJob() {
	var jobID = parseInt($('#job').val());
	var next_tr1 = $('#job').parent().parent().next()
	next_tr2 = next_tr1.next()
	next_tr3 = next_tr2.next()
	next_tr4 = next_tr3.next()
	if (jobID) {
		$('#job').rules('add', { required: true });
		$('#new_job').rules('remove');
		$('#new_job_county').rules('remove');
		$('#new_job_city').rules('remove');
		$('#new_job_address').rules('remove');
		next_tr1.hide();
		next_tr2.hide();
		next_tr3.hide();
		next_tr4.hide();
	} else {
		$('#job').rules('remove');
		$('#new_job').rules('add', { required: true });
		$('#new_job_county').rules('add', { required: true });
		$('#new_job_city').rules('add', { required: true });
		$('#new_job_address').rules('add', { required: true });
		next_tr1.show();
		next_tr2.show();
		next_tr3.show();
		next_tr4.show();
	}
}
